
cmake_minimum_required(VERSION 3.18.1)

set(project_name ipcp)
project(${project_name})

# 设置生成的so文件存放路径
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ../../../../../libs/${ANDROID_ABI})

include_directories(osi/include)

add_definitions(" -Wall -g -DLOG_NDEBUG=1 -D_GNU_SOURCE -DOS_GENERIC -DIPCP_HOST_MODE -UNDEBUG ")
add_definitions(" -Wunused-but-set-variable -Wno-unused-parameter -Wno-typedef-redefinition -Wno-gnu-variable-sized-type-not-at-end -Wextra ")
add_library(ipcp_osi STATIC
        osi/src/alarm.c
        osi/src/allocator.c
        osi/src/compat.c
        osi/src/config.c
        osi/src/eager_reader.c
        osi/src/fixed_queue.c
        osi/src/list.c
        osi/src/mutex.c
        osi/src/osi.c
        osi/src/reactor.c
        osi/src/semaphore.c
        osi/src/socket.c
        osi/src/thread.c
        osi/src/wakelock.c)
find_library(log-lib log)
target_link_libraries(ipcp_osi ${log-lib})

include_directories(./ ipcp/include)
add_library(ipcp SHARED
        ipcp/src/ipcp.c
        ipcp/src/packet.c
        ipcp/src/transport.c
        ipcp/src/service_config.c ./mytest.h)

find_library(rt-lib rt)
find_library(pthread-lib pthread)
find_library(cutils-lib cutils)
target_link_libraries(ipcp ipcp_osi android ${rt} ${pthread} ${cutils} ${log-lib})


